package com.power.project.model;

import com.power.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 附件实体类
 */
@Entity
@ApiModel(value = "")
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Table(name="ha_attachment")
public class HaAttachment extends BaseModel implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @ApiModelProperty(value = "文件名")
    private String filename;

    @ApiModelProperty(value = "文件类型")
    private String filetype;

    @ApiModelProperty(value = "文件大小")
    private Long filesize;

    @ApiModelProperty(value = "存储路径")
    private String path;

    @ApiModelProperty(value = "租户id")
    private String tenantid;

    @Override
    public Map<String, Object> parseMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", this.getId());
        map.put("filename", this.getFilename());
        map.put("filetype", this.getFiletype());
        map.put("filesize", this.getFilesize());
        map.put("path", this.getPath());
        map.put("tenantid", this.getTenantid());
        return map;
    }


    @Override
    public Integer getId() {
        return id;
    }

    @Override
    public void setId(Serializable id) {
        this.id = (Integer) id;
    }

    @Override
    public Serializable getPrimaryKey() {
        return id;
    }

    @Override
    public void setPrimaryKey(Serializable key) {
        this.id = (Integer) key;
    }

}